<?php
/**
 * Eren Framework
 * 
 * Factory for Init DB Adapter
 * 
 * @category System
 * @author Manu Soros Leu
 * @copyright manusoros@gmail.com
 */

class Eren_DB
{
    /**
     * Create DB Adapter
     * 
     * @param string $ObjectName
     * @param array $Config
     * @throws Eren_DB_Exception
     * @return Eren_DB_Adapter
     */
    public static function factory($ObjectName, $Config)
    {
        if(!is_array($Config) || empty($Config)){
            throw new Eren_DB_Exception("The second param of factory must be Array");
        }
        return new Eren_DB_Adapter(new $ObjectName($Config));
    }
}